{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "61e5764b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>gaze_timestamp</th>\n",
       "      <th>world_index</th>\n",
       "      <th>confidence</th>\n",
       "      <th>norm_pos_x</th>\n",
       "      <th>norm_pos_y</th>\n",
       "      <th>base_data</th>\n",
       "      <th>gaze_point_3d_x</th>\n",
       "      <th>gaze_point_3d_y</th>\n",
       "      <th>gaze_point_3d_z</th>\n",
       "      <th>eye_center0_3d_x</th>\n",
       "      <th>...</th>\n",
       "      <th>eye_center0_3d_z</th>\n",
       "      <th>gaze_normal0_x</th>\n",
       "      <th>gaze_normal0_y</th>\n",
       "      <th>gaze_normal0_z</th>\n",
       "      <th>eye_center1_3d_x</th>\n",
       "      <th>eye_center1_3d_y</th>\n",
       "      <th>eye_center1_3d_z</th>\n",
       "      <th>gaze_normal1_x</th>\n",
       "      <th>gaze_normal1_y</th>\n",
       "      <th>gaze_normal1_z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>88150.825638</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493612</td>\n",
       "      <td>0.398950</td>\n",
       "      <td>88150.827729-0 88150.823548-1</td>\n",
       "      <td>2.412810</td>\n",
       "      <td>-21.468145</td>\n",
       "      <td>-295.071057</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150041</td>\n",
       "      <td>0.234536</td>\n",
       "      <td>0.960458</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>88150.827729</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493561</td>\n",
       "      <td>0.399305</td>\n",
       "      <td>88150.827729-0 88150.827729-1</td>\n",
       "      <td>2.429837</td>\n",
       "      <td>-21.374413</td>\n",
       "      <td>-294.819200</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150243</td>\n",
       "      <td>0.234115</td>\n",
       "      <td>0.960530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>88150.829664</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493570</td>\n",
       "      <td>0.399542</td>\n",
       "      <td>88150.827729-0 88150.83159799999-1</td>\n",
       "      <td>2.427118</td>\n",
       "      <td>-21.328193</td>\n",
       "      <td>-294.874516</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150210</td>\n",
       "      <td>0.233747</td>\n",
       "      <td>0.960624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>88150.866015</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492592</td>\n",
       "      <td>0.398705</td>\n",
       "      <td>88150.867514-0 88150.86451599999-1</td>\n",
       "      <td>2.827911</td>\n",
       "      <td>-21.750938</td>\n",
       "      <td>-298.233245</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149814</td>\n",
       "      <td>0.233510</td>\n",
       "      <td>0.960744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>88150.869620</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492635</td>\n",
       "      <td>0.398814</td>\n",
       "      <td>88150.867514-0 88150.871726-1</td>\n",
       "      <td>2.813774</td>\n",
       "      <td>-21.744854</td>\n",
       "      <td>-298.471253</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149645</td>\n",
       "      <td>0.233258</td>\n",
       "      <td>0.960831</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125259</th>\n",
       "      <td>88443.695600</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.995336</td>\n",
       "      <td>0.407831</td>\n",
       "      <td>0.413470</td>\n",
       "      <td>88443.69561-0 88443.695591-1</td>\n",
       "      <td>327.648915</td>\n",
       "      <td>-173.027524</td>\n",
       "      <td>-2777.243340</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.130868</td>\n",
       "      <td>0.093021</td>\n",
       "      <td>0.987026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125260</th>\n",
       "      <td>88443.697570</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.948733</td>\n",
       "      <td>0.407552</td>\n",
       "      <td>0.414731</td>\n",
       "      <td>88443.69561-0 88443.69953099999-1</td>\n",
       "      <td>311.054477</td>\n",
       "      <td>-161.381388</td>\n",
       "      <td>-2628.637408</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125261</th>\n",
       "      <td>88443.701580</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407467</td>\n",
       "      <td>0.414705</td>\n",
       "      <td>88443.703629-0 88443.69953099999-1</td>\n",
       "      <td>313.566509</td>\n",
       "      <td>-162.585330</td>\n",
       "      <td>-2647.420719</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125262</th>\n",
       "      <td>88443.703608</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407160</td>\n",
       "      <td>0.415340</td>\n",
       "      <td>88443.703629-0 88443.703587-1</td>\n",
       "      <td>297.019831</td>\n",
       "      <td>-152.352987</td>\n",
       "      <td>-2499.428189</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.133311</td>\n",
       "      <td>0.091656</td>\n",
       "      <td>0.986827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125263</th>\n",
       "      <td>88443.705574</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407637</td>\n",
       "      <td>0.413674</td>\n",
       "      <td>88443.703629-0 88443.70751899999-1</td>\n",
       "      <td>323.629974</td>\n",
       "      <td>-170.142461</td>\n",
       "      <td>-2737.404466</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.131320</td>\n",
       "      <td>0.092941</td>\n",
       "      <td>0.986974</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>87442 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        gaze_timestamp  world_index  confidence  norm_pos_x  norm_pos_y  \\\n",
       "21        88150.825638            2    0.915197    0.493612    0.398950   \n",
       "22        88150.827729            2    0.915197    0.493561    0.399305   \n",
       "23        88150.829664            2    0.915197    0.493570    0.399542   \n",
       "39        88150.866015            3    0.922197    0.492592    0.398705   \n",
       "40        88150.869620            3    0.922197    0.492635    0.398814   \n",
       "...                ...          ...         ...         ...         ...   \n",
       "125259    88443.695600         8788    0.995336    0.407831    0.413470   \n",
       "125260    88443.697570         8788    0.948733    0.407552    0.414731   \n",
       "125261    88443.701580         8788    0.945284    0.407467    0.414705   \n",
       "125262    88443.703608         8788    0.945284    0.407160    0.415340   \n",
       "125263    88443.705574         8788    0.945284    0.407637    0.413674   \n",
       "\n",
       "                                 base_data  gaze_point_3d_x  gaze_point_3d_y  \\\n",
       "21           88150.827729-0 88150.823548-1         2.412810       -21.468145   \n",
       "22           88150.827729-0 88150.827729-1         2.429837       -21.374413   \n",
       "23      88150.827729-0 88150.83159799999-1         2.427118       -21.328193   \n",
       "39      88150.867514-0 88150.86451599999-1         2.827911       -21.750938   \n",
       "40           88150.867514-0 88150.871726-1         2.813774       -21.744854   \n",
       "...                                    ...              ...              ...   \n",
       "125259        88443.69561-0 88443.695591-1       327.648915      -173.027524   \n",
       "125260   88443.69561-0 88443.69953099999-1       311.054477      -161.381388   \n",
       "125261  88443.703629-0 88443.69953099999-1       313.566509      -162.585330   \n",
       "125262       88443.703629-0 88443.703587-1       297.019831      -152.352987   \n",
       "125263  88443.703629-0 88443.70751899999-1       323.629974      -170.142461   \n",
       "\n",
       "        gaze_point_3d_z  eye_center0_3d_x  ...  eye_center0_3d_z  \\\n",
       "21          -295.071057         20.000000  ...        -20.000000   \n",
       "22          -294.819200         20.000000  ...        -20.000000   \n",
       "23          -294.874516         20.000000  ...        -20.000000   \n",
       "39          -298.233245         20.000000  ...        -20.000000   \n",
       "40          -298.471253         20.000000  ...        -20.000000   \n",
       "...                 ...               ...  ...               ...   \n",
       "125259     -2777.243340         19.888755  ...        -20.707271   \n",
       "125260     -2628.637408         19.888755  ...        -20.707271   \n",
       "125261     -2647.420719         19.888755  ...        -20.707271   \n",
       "125262     -2499.428189         19.888755  ...        -20.707271   \n",
       "125263     -2737.404466         19.888755  ...        -20.707271   \n",
       "\n",
       "        gaze_normal0_x  gaze_normal0_y  gaze_normal0_z  eye_center1_3d_x  \\\n",
       "21            0.062883        0.025100        0.997705        -39.934928   \n",
       "22            0.062883        0.025100        0.997705        -39.934928   \n",
       "23            0.062883        0.025100        0.997705        -39.934928   \n",
       "39            0.060717        0.025220        0.997836        -39.934928   \n",
       "40            0.060717        0.025220        0.997836        -39.934928   \n",
       "...                ...             ...             ...               ...   \n",
       "125259       -0.110854        0.041843        0.992955        -37.372594   \n",
       "125260       -0.110854        0.041843        0.992955        -37.372594   \n",
       "125261       -0.111009        0.041794        0.992940        -37.372594   \n",
       "125262       -0.111009        0.041794        0.992940        -37.372594   \n",
       "125263       -0.111009        0.041794        0.992940        -37.372594   \n",
       "\n",
       "        eye_center1_3d_y  eye_center1_3d_z  gaze_normal1_x  gaze_normal1_y  \\\n",
       "21             14.997919        -20.075283       -0.150041        0.234536   \n",
       "22             14.997919        -20.075283       -0.150243        0.234115   \n",
       "23             14.997919        -20.075283       -0.150210        0.233747   \n",
       "39             14.997919        -20.075283       -0.149814        0.233510   \n",
       "40             14.997919        -20.075283       -0.149645        0.233258   \n",
       "...                  ...               ...             ...             ...   \n",
       "125259         14.763454        -23.294339       -0.130868        0.093021   \n",
       "125260         14.763454        -23.294339       -0.132037        0.091860   \n",
       "125261         14.763454        -23.294339       -0.132037        0.091860   \n",
       "125262         14.763454        -23.294339       -0.133311        0.091656   \n",
       "125263         14.763454        -23.294339       -0.131320        0.092941   \n",
       "\n",
       "        gaze_normal1_z  \n",
       "21            0.960458  \n",
       "22            0.960530  \n",
       "23            0.960624  \n",
       "39            0.960744  \n",
       "40            0.960831  \n",
       "...                ...  \n",
       "125259        0.987026  \n",
       "125260        0.986979  \n",
       "125261        0.986979  \n",
       "125262        0.986827  \n",
       "125263        0.986974  \n",
       "\n",
       "[87442 rows x 21 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 第一题\n",
    "import pandas as pd\n",
    "data = pd.read_csv('/Users/yilin/Desktop/gaze.csv')\n",
    "res1 = data.loc[data['confidence']>=0.9]\n",
    "res1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6f283c30",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>gaze_timestamp</th>\n",
       "      <th>world_index</th>\n",
       "      <th>confidence</th>\n",
       "      <th>norm_pos_x</th>\n",
       "      <th>norm_pos_y</th>\n",
       "      <th>base_data</th>\n",
       "      <th>gaze_point_3d_x</th>\n",
       "      <th>gaze_point_3d_y</th>\n",
       "      <th>gaze_point_3d_z</th>\n",
       "      <th>eye_center0_3d_x</th>\n",
       "      <th>...</th>\n",
       "      <th>eye_center0_3d_z</th>\n",
       "      <th>gaze_normal0_x</th>\n",
       "      <th>gaze_normal0_y</th>\n",
       "      <th>gaze_normal0_z</th>\n",
       "      <th>eye_center1_3d_x</th>\n",
       "      <th>eye_center1_3d_y</th>\n",
       "      <th>eye_center1_3d_z</th>\n",
       "      <th>gaze_normal1_x</th>\n",
       "      <th>gaze_normal1_y</th>\n",
       "      <th>gaze_normal1_z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>88150.825638</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493612</td>\n",
       "      <td>0.398950</td>\n",
       "      <td>88150.827729-0 88150.823548-1</td>\n",
       "      <td>2.412810</td>\n",
       "      <td>-21.468145</td>\n",
       "      <td>-295.071057</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150041</td>\n",
       "      <td>0.234536</td>\n",
       "      <td>0.960458</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>88150.827729</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493561</td>\n",
       "      <td>0.399305</td>\n",
       "      <td>88150.827729-0 88150.827729-1</td>\n",
       "      <td>2.429837</td>\n",
       "      <td>-21.374413</td>\n",
       "      <td>-294.819200</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150243</td>\n",
       "      <td>0.234115</td>\n",
       "      <td>0.960530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>88150.829664</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493570</td>\n",
       "      <td>0.399542</td>\n",
       "      <td>88150.827729-0 88150.83159799999-1</td>\n",
       "      <td>2.427118</td>\n",
       "      <td>-21.328193</td>\n",
       "      <td>-294.874516</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150210</td>\n",
       "      <td>0.233747</td>\n",
       "      <td>0.960624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>88150.866015</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492592</td>\n",
       "      <td>0.398705</td>\n",
       "      <td>88150.867514-0 88150.86451599999-1</td>\n",
       "      <td>2.827911</td>\n",
       "      <td>-21.750938</td>\n",
       "      <td>-298.233245</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149814</td>\n",
       "      <td>0.233510</td>\n",
       "      <td>0.960744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>88150.869620</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492635</td>\n",
       "      <td>0.398814</td>\n",
       "      <td>88150.867514-0 88150.871726-1</td>\n",
       "      <td>2.813774</td>\n",
       "      <td>-21.744854</td>\n",
       "      <td>-298.471253</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149645</td>\n",
       "      <td>0.233258</td>\n",
       "      <td>0.960831</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86180</th>\n",
       "      <td>88443.695600</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.995336</td>\n",
       "      <td>0.407831</td>\n",
       "      <td>0.413470</td>\n",
       "      <td>88443.69561-0 88443.695591-1</td>\n",
       "      <td>327.648915</td>\n",
       "      <td>-173.027524</td>\n",
       "      <td>-2777.243340</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.130868</td>\n",
       "      <td>0.093021</td>\n",
       "      <td>0.987026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86181</th>\n",
       "      <td>88443.697570</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.948733</td>\n",
       "      <td>0.407552</td>\n",
       "      <td>0.414731</td>\n",
       "      <td>88443.69561-0 88443.69953099999-1</td>\n",
       "      <td>311.054477</td>\n",
       "      <td>-161.381388</td>\n",
       "      <td>-2628.637408</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86182</th>\n",
       "      <td>88443.701580</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407467</td>\n",
       "      <td>0.414705</td>\n",
       "      <td>88443.703629-0 88443.69953099999-1</td>\n",
       "      <td>313.566509</td>\n",
       "      <td>-162.585330</td>\n",
       "      <td>-2647.420719</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86183</th>\n",
       "      <td>88443.703608</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407160</td>\n",
       "      <td>0.415340</td>\n",
       "      <td>88443.703629-0 88443.703587-1</td>\n",
       "      <td>297.019831</td>\n",
       "      <td>-152.352987</td>\n",
       "      <td>-2499.428189</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.133311</td>\n",
       "      <td>0.091656</td>\n",
       "      <td>0.986827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86184</th>\n",
       "      <td>88443.705574</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407637</td>\n",
       "      <td>0.413674</td>\n",
       "      <td>88443.703629-0 88443.70751899999-1</td>\n",
       "      <td>323.629974</td>\n",
       "      <td>-170.142461</td>\n",
       "      <td>-2737.404466</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.131320</td>\n",
       "      <td>0.092941</td>\n",
       "      <td>0.986974</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>86185 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       gaze_timestamp  world_index  confidence  norm_pos_x  norm_pos_y  \\\n",
       "0        88150.825638            2    0.915197    0.493612    0.398950   \n",
       "1        88150.827729            2    0.915197    0.493561    0.399305   \n",
       "2        88150.829664            2    0.915197    0.493570    0.399542   \n",
       "3        88150.866015            3    0.922197    0.492592    0.398705   \n",
       "4        88150.869620            3    0.922197    0.492635    0.398814   \n",
       "...               ...          ...         ...         ...         ...   \n",
       "86180    88443.695600         8788    0.995336    0.407831    0.413470   \n",
       "86181    88443.697570         8788    0.948733    0.407552    0.414731   \n",
       "86182    88443.701580         8788    0.945284    0.407467    0.414705   \n",
       "86183    88443.703608         8788    0.945284    0.407160    0.415340   \n",
       "86184    88443.705574         8788    0.945284    0.407637    0.413674   \n",
       "\n",
       "                                base_data  gaze_point_3d_x  gaze_point_3d_y  \\\n",
       "0           88150.827729-0 88150.823548-1         2.412810       -21.468145   \n",
       "1           88150.827729-0 88150.827729-1         2.429837       -21.374413   \n",
       "2      88150.827729-0 88150.83159799999-1         2.427118       -21.328193   \n",
       "3      88150.867514-0 88150.86451599999-1         2.827911       -21.750938   \n",
       "4           88150.867514-0 88150.871726-1         2.813774       -21.744854   \n",
       "...                                   ...              ...              ...   \n",
       "86180        88443.69561-0 88443.695591-1       327.648915      -173.027524   \n",
       "86181   88443.69561-0 88443.69953099999-1       311.054477      -161.381388   \n",
       "86182  88443.703629-0 88443.69953099999-1       313.566509      -162.585330   \n",
       "86183       88443.703629-0 88443.703587-1       297.019831      -152.352987   \n",
       "86184  88443.703629-0 88443.70751899999-1       323.629974      -170.142461   \n",
       "\n",
       "       gaze_point_3d_z  eye_center0_3d_x  ...  eye_center0_3d_z  \\\n",
       "0          -295.071057         20.000000  ...        -20.000000   \n",
       "1          -294.819200         20.000000  ...        -20.000000   \n",
       "2          -294.874516         20.000000  ...        -20.000000   \n",
       "3          -298.233245         20.000000  ...        -20.000000   \n",
       "4          -298.471253         20.000000  ...        -20.000000   \n",
       "...                ...               ...  ...               ...   \n",
       "86180     -2777.243340         19.888755  ...        -20.707271   \n",
       "86181     -2628.637408         19.888755  ...        -20.707271   \n",
       "86182     -2647.420719         19.888755  ...        -20.707271   \n",
       "86183     -2499.428189         19.888755  ...        -20.707271   \n",
       "86184     -2737.404466         19.888755  ...        -20.707271   \n",
       "\n",
       "       gaze_normal0_x  gaze_normal0_y  gaze_normal0_z  eye_center1_3d_x  \\\n",
       "0            0.062883        0.025100        0.997705        -39.934928   \n",
       "1            0.062883        0.025100        0.997705        -39.934928   \n",
       "2            0.062883        0.025100        0.997705        -39.934928   \n",
       "3            0.060717        0.025220        0.997836        -39.934928   \n",
       "4            0.060717        0.025220        0.997836        -39.934928   \n",
       "...               ...             ...             ...               ...   \n",
       "86180       -0.110854        0.041843        0.992955        -37.372594   \n",
       "86181       -0.110854        0.041843        0.992955        -37.372594   \n",
       "86182       -0.111009        0.041794        0.992940        -37.372594   \n",
       "86183       -0.111009        0.041794        0.992940        -37.372594   \n",
       "86184       -0.111009        0.041794        0.992940        -37.372594   \n",
       "\n",
       "       eye_center1_3d_y  eye_center1_3d_z  gaze_normal1_x  gaze_normal1_y  \\\n",
       "0             14.997919        -20.075283       -0.150041        0.234536   \n",
       "1             14.997919        -20.075283       -0.150243        0.234115   \n",
       "2             14.997919        -20.075283       -0.150210        0.233747   \n",
       "3             14.997919        -20.075283       -0.149814        0.233510   \n",
       "4             14.997919        -20.075283       -0.149645        0.233258   \n",
       "...                 ...               ...             ...             ...   \n",
       "86180         14.763454        -23.294339       -0.130868        0.093021   \n",
       "86181         14.763454        -23.294339       -0.132037        0.091860   \n",
       "86182         14.763454        -23.294339       -0.132037        0.091860   \n",
       "86183         14.763454        -23.294339       -0.133311        0.091656   \n",
       "86184         14.763454        -23.294339       -0.131320        0.092941   \n",
       "\n",
       "       gaze_normal1_z  \n",
       "0            0.960458  \n",
       "1            0.960530  \n",
       "2            0.960624  \n",
       "3            0.960744  \n",
       "4            0.960831  \n",
       "...               ...  \n",
       "86180        0.987026  \n",
       "86181        0.986979  \n",
       "86182        0.986979  \n",
       "86183        0.986827  \n",
       "86184        0.986974  \n",
       "\n",
       "[86185 rows x 21 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 第二题\n",
    "mean_x = res1['norm_pos_x'].mean()\n",
    "mean_y = res1['norm_pos_y'].mean()\n",
    "std_x = res1['norm_pos_x'].std()\n",
    "std_y = res1['norm_pos_y'].std()\n",
    "\n",
    "res2 = res1.loc[res1['norm_pos_x']<mean_x+3*std_x]\n",
    "res3 = res2.loc[res2['norm_pos_x']>mean_x-3*std_x]\n",
    "res4 = res3.loc[res3['norm_pos_y']<mean_y+3*std_y]\n",
    "res5 = res4.loc[res4['norm_pos_y']>mean_y-3*std_y]\n",
    "final = res5.reset_index(drop=True)\n",
    "final"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fdcd9c71",
   "metadata": {},
   "outputs": [],
   "source": [
    "final.to_csv('/Users/yilin/Desktop/gaze_new.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9bd9035b",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/yilin/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py:1637: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  self._setitem_single_block(indexer, value, name)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>gaze_timestamp</th>\n",
       "      <th>world_index</th>\n",
       "      <th>confidence</th>\n",
       "      <th>norm_pos_x</th>\n",
       "      <th>norm_pos_y</th>\n",
       "      <th>base_data</th>\n",
       "      <th>gaze_point_3d_x</th>\n",
       "      <th>gaze_point_3d_y</th>\n",
       "      <th>gaze_point_3d_z</th>\n",
       "      <th>eye_center0_3d_x</th>\n",
       "      <th>...</th>\n",
       "      <th>eye_center0_3d_z</th>\n",
       "      <th>gaze_normal0_x</th>\n",
       "      <th>gaze_normal0_y</th>\n",
       "      <th>gaze_normal0_z</th>\n",
       "      <th>eye_center1_3d_x</th>\n",
       "      <th>eye_center1_3d_y</th>\n",
       "      <th>eye_center1_3d_z</th>\n",
       "      <th>gaze_normal1_x</th>\n",
       "      <th>gaze_normal1_y</th>\n",
       "      <th>gaze_normal1_z</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1970-01-01 08:00:00</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493612</td>\n",
       "      <td>0.398950</td>\n",
       "      <td>88150.827729-0 88150.823548-1</td>\n",
       "      <td>2.412810</td>\n",
       "      <td>-21.468145</td>\n",
       "      <td>-295.071057</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150041</td>\n",
       "      <td>0.234536</td>\n",
       "      <td>0.960458</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1970-01-01 08:00:01</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493561</td>\n",
       "      <td>0.399305</td>\n",
       "      <td>88150.827729-0 88150.827729-1</td>\n",
       "      <td>2.429837</td>\n",
       "      <td>-21.374413</td>\n",
       "      <td>-294.819200</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150243</td>\n",
       "      <td>0.234115</td>\n",
       "      <td>0.960530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1970-01-01 08:00:02</td>\n",
       "      <td>2</td>\n",
       "      <td>0.915197</td>\n",
       "      <td>0.493570</td>\n",
       "      <td>0.399542</td>\n",
       "      <td>88150.827729-0 88150.83159799999-1</td>\n",
       "      <td>2.427118</td>\n",
       "      <td>-21.328193</td>\n",
       "      <td>-294.874516</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062883</td>\n",
       "      <td>0.025100</td>\n",
       "      <td>0.997705</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150210</td>\n",
       "      <td>0.233747</td>\n",
       "      <td>0.960624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1970-01-01 08:00:03</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492592</td>\n",
       "      <td>0.398705</td>\n",
       "      <td>88150.867514-0 88150.86451599999-1</td>\n",
       "      <td>2.827911</td>\n",
       "      <td>-21.750938</td>\n",
       "      <td>-298.233245</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149814</td>\n",
       "      <td>0.233510</td>\n",
       "      <td>0.960744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1970-01-01 08:00:04</td>\n",
       "      <td>3</td>\n",
       "      <td>0.922197</td>\n",
       "      <td>0.492635</td>\n",
       "      <td>0.398814</td>\n",
       "      <td>88150.867514-0 88150.871726-1</td>\n",
       "      <td>2.813774</td>\n",
       "      <td>-21.744854</td>\n",
       "      <td>-298.471253</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060717</td>\n",
       "      <td>0.025220</td>\n",
       "      <td>0.997836</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149645</td>\n",
       "      <td>0.233258</td>\n",
       "      <td>0.960831</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86180</th>\n",
       "      <td>1970-01-02 07:56:20</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.995336</td>\n",
       "      <td>0.407831</td>\n",
       "      <td>0.413470</td>\n",
       "      <td>88443.69561-0 88443.695591-1</td>\n",
       "      <td>327.648915</td>\n",
       "      <td>-173.027524</td>\n",
       "      <td>-2777.243340</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.130868</td>\n",
       "      <td>0.093021</td>\n",
       "      <td>0.987026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86181</th>\n",
       "      <td>1970-01-02 07:56:21</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.948733</td>\n",
       "      <td>0.407552</td>\n",
       "      <td>0.414731</td>\n",
       "      <td>88443.69561-0 88443.69953099999-1</td>\n",
       "      <td>311.054477</td>\n",
       "      <td>-161.381388</td>\n",
       "      <td>-2628.637408</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.110854</td>\n",
       "      <td>0.041843</td>\n",
       "      <td>0.992955</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86182</th>\n",
       "      <td>1970-01-02 07:56:22</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407467</td>\n",
       "      <td>0.414705</td>\n",
       "      <td>88443.703629-0 88443.69953099999-1</td>\n",
       "      <td>313.566509</td>\n",
       "      <td>-162.585330</td>\n",
       "      <td>-2647.420719</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.132037</td>\n",
       "      <td>0.091860</td>\n",
       "      <td>0.986979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86183</th>\n",
       "      <td>1970-01-02 07:56:23</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407160</td>\n",
       "      <td>0.415340</td>\n",
       "      <td>88443.703629-0 88443.703587-1</td>\n",
       "      <td>297.019831</td>\n",
       "      <td>-152.352987</td>\n",
       "      <td>-2499.428189</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.133311</td>\n",
       "      <td>0.091656</td>\n",
       "      <td>0.986827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86184</th>\n",
       "      <td>1970-01-02 07:56:24</td>\n",
       "      <td>8788</td>\n",
       "      <td>0.945284</td>\n",
       "      <td>0.407637</td>\n",
       "      <td>0.413674</td>\n",
       "      <td>88443.703629-0 88443.70751899999-1</td>\n",
       "      <td>323.629974</td>\n",
       "      <td>-170.142461</td>\n",
       "      <td>-2737.404466</td>\n",
       "      <td>19.888755</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.707271</td>\n",
       "      <td>-0.111009</td>\n",
       "      <td>0.041794</td>\n",
       "      <td>0.992940</td>\n",
       "      <td>-37.372594</td>\n",
       "      <td>14.763454</td>\n",
       "      <td>-23.294339</td>\n",
       "      <td>-0.131320</td>\n",
       "      <td>0.092941</td>\n",
       "      <td>0.986974</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>86185 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            gaze_timestamp  world_index  confidence  norm_pos_x  norm_pos_y  \\\n",
       "0      1970-01-01 08:00:00            2    0.915197    0.493612    0.398950   \n",
       "1      1970-01-01 08:00:01            2    0.915197    0.493561    0.399305   \n",
       "2      1970-01-01 08:00:02            2    0.915197    0.493570    0.399542   \n",
       "3      1970-01-01 08:00:03            3    0.922197    0.492592    0.398705   \n",
       "4      1970-01-01 08:00:04            3    0.922197    0.492635    0.398814   \n",
       "...                    ...          ...         ...         ...         ...   \n",
       "86180  1970-01-02 07:56:20         8788    0.995336    0.407831    0.413470   \n",
       "86181  1970-01-02 07:56:21         8788    0.948733    0.407552    0.414731   \n",
       "86182  1970-01-02 07:56:22         8788    0.945284    0.407467    0.414705   \n",
       "86183  1970-01-02 07:56:23         8788    0.945284    0.407160    0.415340   \n",
       "86184  1970-01-02 07:56:24         8788    0.945284    0.407637    0.413674   \n",
       "\n",
       "                                base_data  gaze_point_3d_x  gaze_point_3d_y  \\\n",
       "0           88150.827729-0 88150.823548-1         2.412810       -21.468145   \n",
       "1           88150.827729-0 88150.827729-1         2.429837       -21.374413   \n",
       "2      88150.827729-0 88150.83159799999-1         2.427118       -21.328193   \n",
       "3      88150.867514-0 88150.86451599999-1         2.827911       -21.750938   \n",
       "4           88150.867514-0 88150.871726-1         2.813774       -21.744854   \n",
       "...                                   ...              ...              ...   \n",
       "86180        88443.69561-0 88443.695591-1       327.648915      -173.027524   \n",
       "86181   88443.69561-0 88443.69953099999-1       311.054477      -161.381388   \n",
       "86182  88443.703629-0 88443.69953099999-1       313.566509      -162.585330   \n",
       "86183       88443.703629-0 88443.703587-1       297.019831      -152.352987   \n",
       "86184  88443.703629-0 88443.70751899999-1       323.629974      -170.142461   \n",
       "\n",
       "       gaze_point_3d_z  eye_center0_3d_x  ...  eye_center0_3d_z  \\\n",
       "0          -295.071057         20.000000  ...        -20.000000   \n",
       "1          -294.819200         20.000000  ...        -20.000000   \n",
       "2          -294.874516         20.000000  ...        -20.000000   \n",
       "3          -298.233245         20.000000  ...        -20.000000   \n",
       "4          -298.471253         20.000000  ...        -20.000000   \n",
       "...                ...               ...  ...               ...   \n",
       "86180     -2777.243340         19.888755  ...        -20.707271   \n",
       "86181     -2628.637408         19.888755  ...        -20.707271   \n",
       "86182     -2647.420719         19.888755  ...        -20.707271   \n",
       "86183     -2499.428189         19.888755  ...        -20.707271   \n",
       "86184     -2737.404466         19.888755  ...        -20.707271   \n",
       "\n",
       "       gaze_normal0_x  gaze_normal0_y  gaze_normal0_z  eye_center1_3d_x  \\\n",
       "0            0.062883        0.025100        0.997705        -39.934928   \n",
       "1            0.062883        0.025100        0.997705        -39.934928   \n",
       "2            0.062883        0.025100        0.997705        -39.934928   \n",
       "3            0.060717        0.025220        0.997836        -39.934928   \n",
       "4            0.060717        0.025220        0.997836        -39.934928   \n",
       "...               ...             ...             ...               ...   \n",
       "86180       -0.110854        0.041843        0.992955        -37.372594   \n",
       "86181       -0.110854        0.041843        0.992955        -37.372594   \n",
       "86182       -0.111009        0.041794        0.992940        -37.372594   \n",
       "86183       -0.111009        0.041794        0.992940        -37.372594   \n",
       "86184       -0.111009        0.041794        0.992940        -37.372594   \n",
       "\n",
       "       eye_center1_3d_y  eye_center1_3d_z  gaze_normal1_x  gaze_normal1_y  \\\n",
       "0             14.997919        -20.075283       -0.150041        0.234536   \n",
       "1             14.997919        -20.075283       -0.150243        0.234115   \n",
       "2             14.997919        -20.075283       -0.150210        0.233747   \n",
       "3             14.997919        -20.075283       -0.149814        0.233510   \n",
       "4             14.997919        -20.075283       -0.149645        0.233258   \n",
       "...                 ...               ...             ...             ...   \n",
       "86180         14.763454        -23.294339       -0.130868        0.093021   \n",
       "86181         14.763454        -23.294339       -0.132037        0.091860   \n",
       "86182         14.763454        -23.294339       -0.132037        0.091860   \n",
       "86183         14.763454        -23.294339       -0.133311        0.091656   \n",
       "86184         14.763454        -23.294339       -0.131320        0.092941   \n",
       "\n",
       "       gaze_normal1_z  \n",
       "0            0.960458  \n",
       "1            0.960530  \n",
       "2            0.960624  \n",
       "3            0.960744  \n",
       "4            0.960831  \n",
       "...               ...  \n",
       "86180        0.987026  \n",
       "86181        0.986979  \n",
       "86182        0.986979  \n",
       "86183        0.986827  \n",
       "86184        0.986974  \n",
       "\n",
       "[86185 rows x 21 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 第三题\n",
    "import csv\n",
    "import time\n",
    "\n",
    "with open('/Users/yilin/Desktop/gaze_new.csv','r') as csvfile:\n",
    "    reader = csv.reader(csvfile)\n",
    "    columns = [row[0] for row in reader]\n",
    "columns\n",
    "\n",
    "columns.pop(0)\n",
    "j = 0\n",
    "for i in columns:\n",
    "    timeArray = time.localtime(float(i))\n",
    "    Timestyle = time.strftime(\"%Y-%m-%d %H:%M:%S\", timeArray)\n",
    "    final['gaze_timestamp'].loc[j] = Timestyle\n",
    "    j += 1\n",
    "final"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "10959d20",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "427.62610766081644"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 第四题\n",
    "length = len(data)\n",
    "t1 = data['gaze_timestamp'][0]\n",
    "t2 = data['gaze_timestamp'][125263]\n",
    "ratio = length / (t2 - t1)\n",
    "ratio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "16a5244d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[gaze_timestamp        88150.77678\n",
       " world_index                     0\n",
       " confidence               0.828006\n",
       " norm_pos_x               0.531433\n",
       " norm_pos_y               0.397509\n",
       " base_data           88150.77678-0\n",
       " gaze_point_3d_x         28.369753\n",
       " gaze_point_3d_y         52.033135\n",
       " gaze_point_3d_z        705.121116\n",
       " eye_center0_3d_x             20.0\n",
       " eye_center0_3d_y             15.0\n",
       " eye_center0_3d_z            -20.0\n",
       " gaze_normal0_x           0.011527\n",
       " gaze_normal0_y           0.051002\n",
       " gaze_normal0_z           0.998632\n",
       " eye_center1_3d_x              NaN\n",
       " eye_center1_3d_y              NaN\n",
       " eye_center1_3d_z              NaN\n",
       " gaze_normal1_x                NaN\n",
       " gaze_normal1_y                NaN\n",
       " gaze_normal1_z                NaN\n",
       " Name: 0, dtype: object,\n",
       " gaze_timestamp        88150.787485\n",
       " world_index                      1\n",
       " confidence                0.502595\n",
       " norm_pos_x                0.340109\n",
       " norm_pos_y                0.142989\n",
       " base_data           88150.787485-1\n",
       " gaze_point_3d_x         -139.40486\n",
       " gaze_point_3d_y         175.088321\n",
       " gaze_point_3d_z         681.151453\n",
       " eye_center0_3d_x        -39.934928\n",
       " eye_center0_3d_y         14.997919\n",
       " eye_center0_3d_z        -20.075283\n",
       " gaze_normal0_x           -0.136989\n",
       " gaze_normal0_y            0.220475\n",
       " gaze_normal0_z            0.965725\n",
       " eye_center1_3d_x               NaN\n",
       " eye_center1_3d_y               NaN\n",
       " eye_center1_3d_z               NaN\n",
       " gaze_normal1_x                 NaN\n",
       " gaze_normal1_y                 NaN\n",
       " gaze_normal1_z                 NaN\n",
       " Name: 4, dtype: object,\n",
       " gaze_timestamp                      88150.798407\n",
       " world_index                                    1\n",
       " confidence                              0.708476\n",
       " norm_pos_x                              0.494116\n",
       " norm_pos_y                              0.407109\n",
       " base_data           88150.79569-0 88150.801123-1\n",
       " gaze_point_3d_x                         2.179629\n",
       " gaze_point_3d_y                        -19.35453\n",
       " gaze_point_3d_z                      -289.386597\n",
       " eye_center0_3d_x                            20.0\n",
       " eye_center0_3d_y                            15.0\n",
       " eye_center0_3d_z                           -20.0\n",
       " gaze_normal0_x                          0.065145\n",
       " gaze_normal0_y                          0.027374\n",
       " gaze_normal0_z                            0.9975\n",
       " eye_center1_3d_x                      -39.934928\n",
       " eye_center1_3d_y                       14.997919\n",
       " eye_center1_3d_z                      -20.075283\n",
       " gaze_normal1_x                         -0.152523\n",
       " gaze_normal1_y                          0.222659\n",
       " gaze_normal1_z                          0.962891\n",
       " Name: 9, dtype: object,\n",
       " gaze_timestamp                       88150.80727\n",
       " world_index                                    1\n",
       " confidence                              0.856341\n",
       " norm_pos_x                              0.494777\n",
       " norm_pos_y                              0.404969\n",
       " base_data           88150.809749-0 88150.80479-1\n",
       " gaze_point_3d_x                         1.925755\n",
       " gaze_point_3d_y                       -19.710658\n",
       " gaze_point_3d_z                      -288.072115\n",
       " eye_center0_3d_x                            20.0\n",
       " eye_center0_3d_y                            15.0\n",
       " eye_center0_3d_z                           -20.0\n",
       " gaze_normal0_x                          0.066338\n",
       " gaze_normal0_y                           0.02384\n",
       " gaze_normal0_z                          0.997512\n",
       " eye_center1_3d_x                      -39.934928\n",
       " eye_center1_3d_y                       14.997919\n",
       " eye_center1_3d_z                      -20.075283\n",
       " gaze_normal1_x                         -0.152228\n",
       " gaze_normal1_y                          0.229814\n",
       " gaze_normal1_z                          0.961255\n",
       " Name: 13, dtype: object,\n",
       " gaze_timestamp                            88150.818051\n",
       " world_index                                          2\n",
       " confidence                                    0.836166\n",
       " norm_pos_x                                    0.493772\n",
       " norm_pos_y                                     0.40027\n",
       " base_data           88150.81599799999-0 88150.820104-1\n",
       " gaze_point_3d_x                               2.325815\n",
       " gaze_point_3d_y                             -20.950335\n",
       " gaze_point_3d_z                            -291.765325\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.063962\n",
       " gaze_normal0_y                                0.024893\n",
       " gaze_normal0_z                                0.997642\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.151527\n",
       " gaze_normal1_y                                0.234143\n",
       " gaze_normal1_z                                0.960321\n",
       " Name: 18, dtype: object,\n",
       " gaze_timestamp                       88150.827729\n",
       " world_index                                     2\n",
       " confidence                               0.915197\n",
       " norm_pos_x                               0.493561\n",
       " norm_pos_y                               0.399305\n",
       " base_data           88150.827729-0 88150.827729-1\n",
       " gaze_point_3d_x                          2.429837\n",
       " gaze_point_3d_y                        -21.374413\n",
       " gaze_point_3d_z                         -294.8192\n",
       " eye_center0_3d_x                             20.0\n",
       " eye_center0_3d_y                             15.0\n",
       " eye_center0_3d_z                            -20.0\n",
       " gaze_normal0_x                           0.062883\n",
       " gaze_normal0_y                             0.0251\n",
       " gaze_normal0_z                           0.997705\n",
       " eye_center1_3d_x                       -39.934928\n",
       " eye_center1_3d_y                        14.997919\n",
       " eye_center1_3d_z                       -20.075283\n",
       " gaze_normal1_x                          -0.150243\n",
       " gaze_normal1_y                           0.234115\n",
       " gaze_normal1_z                            0.96053\n",
       " Name: 22, dtype: object,\n",
       " gaze_timestamp                                 88150.839575\n",
       " world_index                                               2\n",
       " confidence                                         0.898123\n",
       " norm_pos_x                                         0.493449\n",
       " norm_pos_y                                         0.398484\n",
       " base_data           88150.83570099999-0 88150.84344899999-1\n",
       " gaze_point_3d_x                                    2.469473\n",
       " gaze_point_3d_y                                  -21.525123\n",
       " gaze_point_3d_z                                 -294.494617\n",
       " eye_center0_3d_x                                       20.0\n",
       " eye_center0_3d_y                                       15.0\n",
       " eye_center0_3d_z                                      -20.0\n",
       " gaze_normal0_x                                     0.062819\n",
       " gaze_normal0_y                                     0.027157\n",
       " gaze_normal0_z                                     0.997655\n",
       " eye_center1_3d_x                                 -39.934928\n",
       " eye_center1_3d_y                                  14.997919\n",
       " eye_center1_3d_z                                 -20.075283\n",
       " gaze_normal1_x                                    -0.150562\n",
       " gaze_normal1_y                                     0.233448\n",
       " gaze_normal1_z                                     0.960642\n",
       " Name: 27, dtype: object,\n",
       " gaze_timestamp                            88150.849505\n",
       " world_index                                          3\n",
       " confidence                                    0.814635\n",
       " norm_pos_x                                    0.492453\n",
       " norm_pos_y                                    0.398923\n",
       " base_data           88150.85153599999-0 88150.847474-1\n",
       " gaze_point_3d_x                               2.852103\n",
       " gaze_point_3d_y                             -21.486779\n",
       " gaze_point_3d_z                            -295.248611\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.061283\n",
       " gaze_normal0_y                                0.025669\n",
       " gaze_normal0_z                                 0.99779\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.151476\n",
       " gaze_normal1_y                                0.233933\n",
       " gaze_normal1_z                                 0.96038\n",
       " Name: 31, dtype: object,\n",
       " gaze_timestamp                                 88150.859561\n",
       " world_index                                               3\n",
       " confidence                                         0.832982\n",
       " norm_pos_x                                         0.493051\n",
       " norm_pos_y                                         0.397208\n",
       " base_data           88150.85955699999-0 88150.85956499999-1\n",
       " gaze_point_3d_x                                     2.65359\n",
       " gaze_point_3d_y                                  -22.079776\n",
       " gaze_point_3d_z                                 -298.333582\n",
       " eye_center0_3d_x                                       20.0\n",
       " eye_center0_3d_y                                       15.0\n",
       " eye_center0_3d_z                                      -20.0\n",
       " gaze_normal0_x                                     0.061304\n",
       " gaze_normal0_y                                     0.026883\n",
       " gaze_normal0_z                                     0.997757\n",
       " eye_center1_3d_x                                 -39.934928\n",
       " eye_center1_3d_y                                  14.997919\n",
       " eye_center1_3d_z                                 -20.075283\n",
       " gaze_normal1_x                                    -0.149152\n",
       " gaze_normal1_y                                     0.234053\n",
       " gaze_normal1_z                                     0.960715\n",
       " Name: 36, dtype: object,\n",
       " gaze_timestamp                        88150.86962\n",
       " world_index                                     3\n",
       " confidence                               0.922197\n",
       " norm_pos_x                               0.492635\n",
       " norm_pos_y                               0.398814\n",
       " base_data           88150.867514-0 88150.871726-1\n",
       " gaze_point_3d_x                          2.813774\n",
       " gaze_point_3d_y                        -21.744854\n",
       " gaze_point_3d_z                       -298.471253\n",
       " eye_center0_3d_x                             20.0\n",
       " eye_center0_3d_y                             15.0\n",
       " eye_center0_3d_z                            -20.0\n",
       " gaze_normal0_x                           0.060717\n",
       " gaze_normal0_y                            0.02522\n",
       " gaze_normal0_z                           0.997836\n",
       " eye_center1_3d_x                       -39.934928\n",
       " eye_center1_3d_y                        14.997919\n",
       " eye_center1_3d_z                       -20.075283\n",
       " gaze_normal1_x                          -0.149645\n",
       " gaze_normal1_y                           0.233258\n",
       " gaze_normal1_z                           0.960831\n",
       " Name: 40, dtype: object,\n",
       " gaze_timestamp                            88150.879584\n",
       " world_index                                          4\n",
       " confidence                                       0.945\n",
       " norm_pos_x                                    0.492159\n",
       " norm_pos_y                                    0.398855\n",
       " base_data           88150.879586-0 88150.87958299999-1\n",
       " gaze_point_3d_x                               2.996872\n",
       " gaze_point_3d_y                             -21.746449\n",
       " gaze_point_3d_z                            -298.615702\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                 0.06004\n",
       " gaze_normal0_y                                0.024936\n",
       " gaze_normal0_z                                0.997884\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.150193\n",
       " gaze_normal1_y                                0.233409\n",
       " gaze_normal1_z                                0.960709\n",
       " Name: 44, dtype: object,\n",
       " gaze_timestamp                       88150.889997\n",
       " world_index                                     4\n",
       " confidence                               0.825607\n",
       " norm_pos_x                               0.492182\n",
       " norm_pos_y                                 0.3974\n",
       " base_data           88150.888291-0 88150.891702-1\n",
       " gaze_point_3d_x                          3.013483\n",
       " gaze_point_3d_y                        -22.246902\n",
       " gaze_point_3d_z                       -301.155509\n",
       " eye_center0_3d_x                             20.0\n",
       " eye_center0_3d_y                             15.0\n",
       " eye_center0_3d_z                            -20.0\n",
       " gaze_normal0_x                           0.059439\n",
       " gaze_normal0_y                           0.025782\n",
       " gaze_normal0_z                           0.997899\n",
       " eye_center1_3d_x                       -39.934928\n",
       " eye_center1_3d_y                        14.997919\n",
       " eye_center1_3d_z                       -20.075283\n",
       " gaze_normal1_x                          -0.148916\n",
       " gaze_normal1_y                           0.233733\n",
       " gaze_normal1_z                           0.960829\n",
       " Name: 49, dtype: object,\n",
       " gaze_timestamp                            88150.899511\n",
       " world_index                                          4\n",
       " confidence                                    0.821103\n",
       " norm_pos_x                                     0.49126\n",
       " norm_pos_y                                    0.398452\n",
       " base_data           88150.89951199999-0 88150.899511-1\n",
       " gaze_point_3d_x                               3.355394\n",
       " gaze_point_3d_y                             -21.929324\n",
       " gaze_point_3d_z                            -299.930569\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.058504\n",
       " gaze_normal0_y                                0.025053\n",
       " gaze_normal0_z                                0.997973\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.150724\n",
       " gaze_normal1_y                                0.233361\n",
       " gaze_normal1_z                                0.960638\n",
       " Name: 53, dtype: object,\n",
       " gaze_timestamp                                 88150.909398\n",
       " world_index                                               4\n",
       " confidence                                         0.860093\n",
       " norm_pos_x                                           0.4915\n",
       " norm_pos_y                                          0.39843\n",
       " base_data           88150.90741599999-0 88150.91137999999-1\n",
       " gaze_point_3d_x                                     3.28235\n",
       " gaze_point_3d_y                                  -22.061576\n",
       " gaze_point_3d_z                                  -301.67539\n",
       " eye_center0_3d_x                                       20.0\n",
       " eye_center0_3d_y                                       15.0\n",
       " eye_center0_3d_z                                      -20.0\n",
       " gaze_normal0_x                                     0.058395\n",
       " gaze_normal0_y                                        0.024\n",
       " gaze_normal0_z                                     0.998005\n",
       " eye_center1_3d_x                                 -39.934928\n",
       " eye_center1_3d_y                                  14.997919\n",
       " eye_center1_3d_z                                 -20.075283\n",
       " gaze_normal1_x                                    -0.149559\n",
       " gaze_normal1_y                                     0.233748\n",
       " gaze_normal1_z                                     0.960726\n",
       " Name: 57, dtype: object,\n",
       " gaze_timestamp                            88150.919424\n",
       " world_index                                          5\n",
       " confidence                                    0.856588\n",
       " norm_pos_x                                    0.491391\n",
       " norm_pos_y                                    0.396667\n",
       " base_data           88150.91942399999-0 88150.919423-1\n",
       " gaze_point_3d_x                               3.336275\n",
       " gaze_point_3d_y                             -22.524998\n",
       " gaze_point_3d_z                             -302.75705\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.057982\n",
       " gaze_normal0_y                                0.026013\n",
       " gaze_normal0_z                                0.997979\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.149174\n",
       " gaze_normal1_y                                0.233957\n",
       " gaze_normal1_z                                0.960735\n",
       " Name: 62, dtype: object,\n",
       " gaze_timestamp                            88150.927525\n",
       " world_index                                          5\n",
       " confidence                                    0.853041\n",
       " norm_pos_x                                    0.491452\n",
       " norm_pos_y                                    0.397485\n",
       " base_data           88150.927522-0 88150.92752699999-1\n",
       " gaze_point_3d_x                               3.323771\n",
       " gaze_point_3d_y                             -22.422425\n",
       " gaze_point_3d_z                            -303.781499\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.057815\n",
       " gaze_normal0_y                                0.023935\n",
       " gaze_normal0_z                                 0.99804\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.148602\n",
       " gaze_normal1_y                                0.234394\n",
       " gaze_normal1_z                                0.960717\n",
       " Name: 65, dtype: object,\n",
       " gaze_timestamp                                  88150.93856\n",
       " world_index                                               5\n",
       " confidence                                         0.998744\n",
       " norm_pos_x                                         0.491162\n",
       " norm_pos_y                                         0.396321\n",
       " base_data           88150.93622799999-0 88150.94089099999-1\n",
       " gaze_point_3d_x                                    3.444671\n",
       " gaze_point_3d_y                                  -22.729378\n",
       " gaze_point_3d_z                                 -304.484514\n",
       " eye_center0_3d_x                                       20.0\n",
       " eye_center0_3d_y                                       15.0\n",
       " eye_center0_3d_z                                      -20.0\n",
       " gaze_normal0_x                                     0.057256\n",
       " gaze_normal0_y                                     0.025568\n",
       " gaze_normal0_z                                     0.998032\n",
       " eye_center1_3d_x                                 -39.934928\n",
       " eye_center1_3d_y                                  14.997919\n",
       " eye_center1_3d_z                                 -20.075283\n",
       " gaze_normal1_x                                    -0.148648\n",
       " gaze_normal1_y                                      0.23424\n",
       " gaze_normal1_z                                     0.960747\n",
       " Name: 69, dtype: object,\n",
       " gaze_timestamp                       88150.947523\n",
       " world_index                                     6\n",
       " confidence                               0.803616\n",
       " norm_pos_x                               0.491624\n",
       " norm_pos_y                               0.396118\n",
       " base_data           88150.947523-0 88150.947523-1\n",
       " gaze_point_3d_x                          3.262791\n",
       " gaze_point_3d_y                        -22.761999\n",
       " gaze_point_3d_z                       -304.324652\n",
       " eye_center0_3d_x                             20.0\n",
       " eye_center0_3d_y                             15.0\n",
       " eye_center0_3d_z                            -20.0\n",
       " gaze_normal0_x                           0.057914\n",
       " gaze_normal0_y                           0.025849\n",
       " gaze_normal0_z                           0.997987\n",
       " eye_center1_3d_x                       -39.934928\n",
       " eye_center1_3d_y                        14.997919\n",
       " eye_center1_3d_z                       -20.075283\n",
       " gaze_normal1_x                          -0.148117\n",
       " gaze_normal1_y                           0.234331\n",
       " gaze_normal1_z                           0.960807\n",
       " Name: 74, dtype: object,\n",
       " gaze_timestamp                            88150.959503\n",
       " world_index                                          6\n",
       " confidence                                    0.839119\n",
       " norm_pos_x                                    0.491028\n",
       " norm_pos_y                                    0.397471\n",
       " base_data           88150.963521-0 88150.95548399999-1\n",
       " gaze_point_3d_x                               3.496927\n",
       " gaze_point_3d_y                             -22.477999\n",
       " gaze_point_3d_z                            -304.492535\n",
       " eye_center0_3d_x                                  20.0\n",
       " eye_center0_3d_y                                  15.0\n",
       " eye_center0_3d_z                                 -20.0\n",
       " gaze_normal0_x                                0.057075\n",
       " gaze_normal0_y                                0.023795\n",
       " gaze_normal0_z                                0.998086\n",
       " eye_center1_3d_x                            -39.934928\n",
       " eye_center1_3d_y                             14.997919\n",
       " eye_center1_3d_z                            -20.075283\n",
       " gaze_normal1_x                               -0.148821\n",
       " gaze_normal1_y                                0.234277\n",
       " gaze_normal1_z                                0.960712\n",
       " Name: 78, dtype: object,\n",
       " gaze_timestamp                           88150.969508\n",
       " world_index                                         6\n",
       " confidence                                   0.892754\n",
       " norm_pos_x                                   0.490926\n",
       " norm_pos_y                                   0.396929\n",
       " base_data           88150.96744-0 88150.97157499999-1\n",
       " gaze_point_3d_x                               3.55408\n",
       " gaze_point_3d_y                             -22.70782\n",
       " gaze_point_3d_z                           -305.989272\n",
       " eye_center0_3d_x                                 20.0\n",
       " eye_center0_3d_y                                 15.0\n",
       " eye_center0_3d_z                                -20.0\n",
       " gaze_normal0_x                               0.056584\n",
       " gaze_normal0_y                               0.024529\n",
       " gaze_normal0_z                               0.998096\n",
       " eye_center1_3d_x                           -39.934928\n",
       " eye_center1_3d_y                            14.997919\n",
       " eye_center1_3d_z                           -20.075283\n",
       " gaze_normal1_x                              -0.148257\n",
       " gaze_normal1_y                               0.233795\n",
       " gaze_normal1_z                               0.960916\n",
       " Name: 83, dtype: object]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 第五题\n",
    "info = data['gaze_timestamp'][0]\n",
    "lst = []\n",
    "lst.append(data.iloc[0,:])\n",
    "i = 1\n",
    "a = 1\n",
    "b = 1\n",
    "x = 0.01\n",
    "while len(lst) < 20 :\n",
    "    a = abs(float(data['gaze_timestamp'][i] - info - x))\n",
    "    if a >= b:\n",
    "        a = 1\n",
    "        lst.append(data.iloc[i-1,:])\n",
    "        info = data['gaze_timestamp'][i-1]\n",
    "    i += 1\n",
    "    b = a\n",
    "lst"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "adc5ca42",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
